﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Scoreboard.Interfaces;
using System.ComponentModel;
using Scoreboard.Model;
using System.ServiceModel.DomainServices.Client;
using Scoreboard.Model.Services;

namespace Scoreboard.Repository
{
	public class GameRepository : Repository, IGameRepository
	{
		public GameRepository(ScoreboardDomainContext context) : base(context)
		{

		}

		public void AddTournamentResult(User player, User playerMate, User opponent, User opponentMate, double participantScore, double opponentScore, int groupId, Action<InvokeOperation> callback)
		{
			Context.EnterTournamentResult(player, playerMate, opponent, opponentMate, 
				participantScore, opponentScore, groupId, callback, null);
		}

		public void AddRatingResult(User player, User playerMate, User opponent, User opponentMate, double participantScore, double opponentScore, Action<InvokeOperation> callback)
		{
			Context.EnterRatingResult(player, playerMate, opponent, opponentMate,
				participantScore, opponentScore, callback, null);
		}

		public void GetRatingGames(Action<LoadOperation<Game>> callback)
		{
			Context.Load(Context.GetRatingGamesQuery(), callback, null);
		}
	}
}
